<route lang="yaml">
meta:
  title: 主页
  icon: ant-design:home-twotone
</route>

<script setup>
import { ref } from 'vue'
import { ElMessage } from 'element-plus'
import { useRouter } from 'vue-router'

const router = useRouter()


// 快捷操作处理
const handleQuickAction = (action) => {
  // switch (action) {
  //   case 'user':
  //     ElMessage.info('订单管理功能开发中...')
  //     break
  //   case 'order':
  //     ElMessage.info('订单管理功能开发中...')
  //     break
  //   case 'product':
  //     ElMessage.info('商品管理功能开发中...')
  //     break
  //   case 'report':
  //     ElMessage.info('数据报表功能开发中...')
  //     break
  //   default:
  //     ElMessage.warning('未知操作')
  // }
}

</script>

<template>
  <div>
    <FaPageHeader>
      <template #title>
        <div class="flex items-center gap-4">
          欢迎使用 Easy-Admin
        </div>
      </template>
    </FaPageHeader>
    <div class="w-full flex flex-col gap-6 px-4 xl-flex-row">
      <!-- 左侧主要内容区域 -->
      <div class="flex-1 space-y-4">
        <!-- 统计卡片区域 -->
        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
          <div class="bg-blue-100 border border-blue-200 p-4 hover:bg-blue-150 transition-colors">
            <div class="flex items-center justify-between">
              <div>
                <p class="text-sm font-medium text-blue-700">今日访问量</p>
                <p class="text-3xl font-bold text-blue-800">1,234</p>
                <p class="text-xs text-blue-600 mt-2">↗ +12.5%</p>
              </div>
              <div class="w-16 h-16 bg-blue-200 flex items-center justify-center">
                <el-icon class="text-blue-600 text-2xl"><View /></el-icon>
              </div>
            </div>
          </div>
          
          <div class="bg-green-100 border border-green-200 p-4 hover:bg-green-150 transition-colors">
            <div class="flex items-center justify-between">
              <div>
                <p class="text-sm font-medium text-green-700">用户总数</p>
                <p class="text-3xl font-bold text-green-800">8,567</p>
                <p class="text-xs text-green-600 mt-2">↗ +5.2%</p>
              </div>
              <div class="w-16 h-16 bg-green-200 flex items-center justify-center">
                <el-icon class="text-green-600 text-2xl"><User /></el-icon>
              </div>
            </div>
          </div>
          
          <div class="bg-orange-100 border border-orange-200 p-4 hover:bg-orange-150 transition-colors">
            <div class="flex items-center justify-between">
              <div>
                <p class="text-sm font-medium text-orange-700">订单数量</p>
                <p class="text-3xl font-bold text-orange-800">456</p>
                <p class="text-xs text-red-600 mt-2">↘ -2.1%</p>
              </div>
              <div class="w-16 h-16 bg-orange-200 flex items-center justify-center">
                <el-icon class="text-orange-600 text-2xl"><ShoppingCart /></el-icon>
              </div>
            </div>
          </div>
          
          <div class="bg-purple-100 border border-purple-200 p-4 hover:bg-purple-150 transition-colors">
            <div class="flex items-center justify-between">
              <div>
                <p class="text-sm font-medium text-purple-700">收入金额</p>
                <p class="text-3xl font-bold text-purple-800">¥89,234</p>
                <p class="text-xs text-green-600 mt-2">↗ +8.7%</p>
              </div>
              <div class="w-16 h-16 bg-purple-200 flex items-center justify-center">
                <el-icon class="text-purple-600 text-2xl"><Money /></el-icon>
              </div>
            </div>
          </div>
        </div>
        
        <!-- 图表区域 -->
        <div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
          <div class="bg-white border border-gray-300 p-4">
            <div class="border-b border-gray-200 pb-2 mb-4">
              <h3 class="text-xl font-bold text-gray-800">访问趋势</h3>
            </div>
            <div class="h-48 flex items-center justify-center bg-gray-50">
              <div class="text-center">
                <div class="w-16 h-16 bg-blue-200 flex items-center justify-center mb-4 mx-auto">
                  <el-icon class="text-blue-600 text-3xl"><TrendCharts /></el-icon>
                </div>
                <p class="text-gray-600 font-medium">图表组件待集成</p>
              </div>
            </div>
          </div>
          
          <div class="bg-white border border-gray-300 p-4">
            <div class="border-b border-gray-200 pb-2 mb-4">
              <h3 class="text-xl font-bold text-gray-800">用户分布</h3>
            </div>
            <div class="h-64 flex items-center justify-center bg-gray-50">
              <div class="text-center">
                <div class="w-16 h-16 bg-green-200 flex items-center justify-center mb-4 mx-auto">
                  <el-icon class="text-green-600 text-3xl"><PieChart /></el-icon>
                </div>
                <p class="text-gray-600 font-medium">图表组件待集成</p>
              </div>
            </div>
          </div>
        </div>
      </div>
      
      <!-- 右侧边栏 -->
      <div class="w-full xl:w-80 space-y-4">
        <!-- 快捷操作 -->
        <div class="bg-white border border-gray-300 p-4">
          <div class="border-b border-gray-200 pb-2 mb-4">
            <h3 class="text-xl font-bold text-gray-800">快捷操作</h3>
          </div>
          <div class="grid grid-cols-1 gap-3">
            <button class="bg-blue-100 border border-blue-300 text-blue-700 p-3 hover:bg-blue-200 transition-colors flex items-center justify-center space-x-3" @click="handleQuickAction('user')">
              <el-icon class="text-xl"><UserFilled /></el-icon>
              <span class="font-medium">用户管理</span>
            </button>
            <button class="bg-green-100 border border-green-300 text-green-700 p-3 hover:bg-green-200 transition-colors flex items-center justify-center space-x-3" @click="handleQuickAction('order')">
              <el-icon class="text-xl"><ShoppingCartFull /></el-icon>
              <span class="font-medium">待办事项</span>
            </button>
            <button class="bg-purple-100 border border-purple-300 text-purple-700 p-3 hover:bg-purple-200 transition-colors flex items-center justify-center space-x-3" @click="handleQuickAction('report')">
              <el-icon class="text-xl"><DataAnalysis /></el-icon>
              <span class="font-medium">数据报表</span>
            </button>
          </div>
        </div>
        <!-- 最近活动 -->
        <div class="bg-white border border-gray-300 p-4">
          <div class="border-b border-gray-200 pb-2 mb-4">
            <h3 class="text-xl font-bold text-gray-800">通知公告</h3>
          </div>
          <div class="space-y-3">
            <div class="bg-blue-500 border border-blue-600 p-3">
              <p class="text-sm font-bold text-white">系统维护通知</p>
              <p class="text-xs text-blue-100 mt-2">系统将于今晚22:00-24:00进行维护升级</p>
            </div>
            <div class="bg-green-500 border border-green-600 p-3">
              <p class="text-sm font-bold text-white">新功能上线</p>
              <p class="text-xs text-green-100 mt-2">工作流管理功能已正式上线</p>
            </div>
            <div class="bg-yellow-500 border border-yellow-600 p-3">
              <p class="text-sm font-bold text-white">安全提醒</p>
              <p class="text-xs text-yellow-100 mt-2">请定期更换密码，确保账户安全</p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
